<?
require '../inc.php';
$act  = $_REQUEST['act'];
$ourl = isset($_REQUEST['ourl'])?$_REQUEST['ourl']:surl::get('my').'index.php';
$eurl = isset($_REQUEST['eurl'])?$_REQUEST['eurl']:surl::get();
switch($act)
{
	case 'login':
		$urs = $_POST['urs'];
		$pwd = $_POST['pwd'];
		$db_member 	= new db($scfg['db']['member']);
		$rs = u::login($urs,$pwd);
		if($rs[0])
		{
			$bind = array(
				'time'=>time(),
				'username'=>$rs[2]['urs'],
				'password'=>$rs[2]['pwd'],
				'email'=>$rs[2]['mail'],
			);
			dzapi::login($bind,$ourl);
			//g::gowin($ourl);
		}else
		{
			echo g::msg($rs[1]);
			g::gowin($eurl);
		}
	break;
	case 'outLogin':
		$ourl       = surl::get('www');
		$db_member 	= new db($scfg['db']['member']);
		u::outLogin();
		dzapi::logout($ourl);
		//g::gowin(surl::get('www'));
	break;
}
?>